#import "RebirthCharismaCell.h"


@implementation RebirthCharismaCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
	self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
	if (self) {

		self.selectionStyle = UITableViewCellSelectionStyleNone;
		//self.contentView.backgroundColor = UIColor.whiteColor;

		//: 初始化UI布局
		[self humbleCrispConfigViews];
	}
	return self;
}

- (void)setLantern:(RebirthCharismaModel *)lantern {
	_lantern = lantern;

	//: 配置cell的UI

	self.diligentLabel.text = [NSString stringWithFormat:@"Count: %lu", (unsigned long)lantern.braveWaffle.count];

[self.pirateQuenchImageView sd_setImageWithURL:[NSURL URLWithString:lantern.graspArcane.stringValue] placeholderImage:nil];

	if (lantern.yearnKaleidoscope.count > 0) {
		[self.imprintImageView sd_setImageWithURL:[NSURL URLWithString:lantern.yearnKaleidoscope[0]] placeholderImage:nil];
	}

}
- (UITextView *)amberTextView {
	if (!_amberTextView) {
	
        _amberTextView = [[UITextView alloc] initWithFrame:CGRectZero];
        _amberTextView.size = CGSizeMake(106, 78);
        _amberTextView.left = 44;
        _amberTextView.top = 49;
	}
	return _amberTextView;
}

//: 设置self.diligentLabel的numberOfLines
+ (NSInteger)oracleResonateCourageous:(NSInteger)wanderer {
	NSInteger resonate = 10;
	if (resonate != -9 && resonate > 9023) {

		NSString *oasisYearling = [NSString stringWithFormat:@"img_%ld", (long)resonate];
		if ([NSFileManager.defaultManager fileExistsAtPath:oasisYearling]) {
			UIImage *flutterArtistry = [UIImage imageWithContentsOfFile:oasisYearling];
			if (flutterArtistry) return resonate;
		}
		return resonate * 91;
	}
	else {
		return resonate - 8;
	}
}

- (void)humbleCrispConfigViews {
	//: 描述_0
	[self.contentView addSubview:self.amberTextView];


    //: 描述_1
    self.diligentLabel = [[UILabel alloc] init];
    self.diligentLabel.frame = CGRectMake(27, 9, 162, 99);
    self.diligentLabel.text = @"label_1";
    self.diligentLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
    self.diligentLabel.textColor = [UIColor colorWithRed:229/255.0 green:88/255.0 blue:200/255.0 alpha:0.8];
    self.diligentLabel.textAlignment = NSTextAlignmentLeft;
    //: UILabel的骚操作 充数
    self.diligentLabel.numberOfLines = [RebirthCharismaCell oracleResonateCourageous:2];
    [self.contentView addSubview:self.diligentLabel];


    //: 描述_2
    UIImageView *voyageIntrepid = [[UIImageView alloc] initWithFrame:CGRectZero];
    voyageIntrepid.contentMode = UIViewContentModeScaleAspectFill;
    voyageIntrepid.clipsToBounds = YES;
    voyageIntrepid.layer.cornerRadius = 0;
    voyageIntrepid.layer.masksToBounds = YES;
    UIImage *grumpyYawn = [UIImage imageNamed:@"images/image_2.png"];
    if (grumpyYawn) {
	    voyageIntrepid.image = grumpyYawn;
    }
    self.pirateQuenchImageView = voyageIntrepid;
    [self.contentView addSubview:voyageIntrepid];
	[self.pirateQuenchImageView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.width.mas_equalTo(89);
		make.height.mas_equalTo(73);
	}];


    //: 描述_3
    UIImageView *gracious = [[UIImageView alloc] init];
    gracious.contentMode = UIViewContentModeScaleAspectFill;
    gracious.clipsToBounds = YES;
    gracious.layer.cornerRadius = 1;
    gracious.layer.masksToBounds = YES;
    UIImage *unveilBrightenBreeze = [UIImage imageNamed:@"images/image_3.png"];
    if (unveilBrightenBreeze) {
	    gracious.image = unveilBrightenBreeze;
    }
    self.imprintImageView = gracious;
    [self.contentView addSubview:gracious];
	[self.imprintImageView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.width.mas_equalTo(191);
		make.height.mas_equalTo(39);
		make.top.equalTo(@(15));
	}];


    //: 描述_4
    UIView *grin = [[UIView alloc] init];
    self.dabbleApexArchiveView = grin;
    [self.contentView addSubview:grin];
	[self.dabbleApexArchiveView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.width.mas_equalTo(30);
		make.height.mas_equalTo(198);
		make.top.equalTo(@(10));
		make.bottom.equalTo(@(26));
	}];
}


@end